#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

#define mm(a, n) memset(a, n, sizeof a)
#define mk(a, b) make_pair(a, b)

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}


int n, idx;
int num[55];
vector<string> res(55);
string ch[4] = {"S","H","C","D"};

// 模拟
inline void solution() {
    cin >> n;
    for (int i = 1; i <= 54; i ++ ) 
        cin >> num[i];
    idx = 1;
    for (int i = 0; i < 4; i ++ ) {
        for (int j = 1; j <= 13; j ++) {
            string s = ch[i];
            s += to_string(j);
            res[idx ++] = s;
        }
    }
    res[idx ++ ] = "J1", res[idx ++ ] = "J2";
    vector<string> temp(55);
    for (int i = 1; i <= n; i ++ ) {
        for (int j = 1; j <= 54; j++) {
            temp[num[j]] = res[j];
        }
        res = temp;
    }
    cout << res[1];
    for (int i = 2; i <= 54; i ++ ) 
        cout << " " << res[i];
    cout << endl;
    return ;
}

int main() {
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}